import { WFileName,getFileName } from "../utils/tools.js";

// import.meta.url 是指当前模块的元信息
let f_name = WFileName(import.meta.url);
let fileName = getFileName(f_name);
// 获取短文件名

async function fn_getAll(ctx) {
    ctx.body = "显示所有用户";
}
async function fn_getById(ctx) {
  let id = ctx.request.params.id;
  ctx.body = `显示当前ID为${id}的角色`
}
async function fn_post(ctx) {
    ctx.body = "新增用户成功";
}
async function fn_put(ctx) {
    ctx.body = "修改用户成功";
}
async function fn_del(ctx) {
    ctx.body = "删除用户成功";
}

let obj = {};

obj[`get /${fileName}`] = fn_getAll;
obj[`get /${fileName}/:id?`] = fn_getById;
obj[`post /${fileName}`] = fn_post;
obj[`put /${fileName}/:id?`] = fn_put;
obj[`delete /${fileName}/:id?`] = fn_del;

export default obj;

